import React, { Component, Fragment } from 'react'
import { Redirect } from 'react-router-dom'

function auth(Com) {
    return class Index extends Component {
        render() {
            let isLogin = sessionStorage.getItem('token')? <Com/>: <Redirect to="/login"/>
            return <Fragment>
                { isLogin }
            </Fragment>
        }
    }
}

export {
    auth
}
